/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ipccenter.toster.jpa;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import javax.persistence.*;
/**
 *
 * @author 7
 */
@Entity
@Table(name = "SESSIONS")

public class JPASession implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Column(name = "SESSION_ID")
    private BigInteger sessionId;
    @Column(name = "START_DATE")
   
    @Temporal(TemporalType.TIMESTAMP)
    private Date startDate;
    @Column(name = "END_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endDate;
    @JoinColumn(name = "SUITE_ID", referencedColumnName = "SUITE_ID")
    @ManyToOne
    private JPASuite suiteId;
    @JoinColumn(name = "STUDENT_ID", referencedColumnName = "STUDENT_ID")
    @ManyToOne
    private JPAStudent studentId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sessions")
    private Collection<JPATest> tests;

    public JPASession() {
    }

    public JPASession(BigInteger sessionId) {
        this.sessionId = sessionId;
    }

    public BigInteger getSessionId() {
        return sessionId;
    }

    public void setSessionId(BigInteger sessionId) {
        this.sessionId = sessionId;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public JPASuite getSuiteId() {
        return suiteId;
    }

    public void setSuiteId(JPASuite suiteId) {
        this.suiteId = suiteId;
    }

    public JPAStudent getStudentId() {
        return studentId;
    }

    public void setStudentId(JPAStudent studentId) {
        this.studentId = studentId;
    }

    public Collection<JPATest> getTestsCollection() {
        return tests;
    }

    public void setTestsCollection(Collection<JPATest> tests) {
        this.tests = tests;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sessionId != null ? sessionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JPASession)) {
            return false;
        }
        JPASession other = (JPASession) object;
        if ((this.sessionId == null && other.sessionId != null) || (this.sessionId != null && !this.sessionId.equals(other.sessionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.ipccenter.toster.jpa.Sessions[ sessionId=" + sessionId + " ]";
    }
    
}
